package io.github.wanggit.antrpc.console.service.dto;

import io.github.wanggit.antrpc.commons.utils.JsonUtils;
import lombok.Data;

import java.io.Serializable;

@Data
public class NodeDataDTO implements Serializable {

    private static final long serialVersionUID = -9036662925089833565L;

    private String fullPath;

    private Long ts;

    public NodeDataDTO() {}

    public NodeDataDTO(String fullPath, Long ts) {
        this.fullPath = fullPath;
        this.ts = ts;
    }

    public static byte[] toBytes(NodeDataDTO nodeDataDTO) {
        return JsonUtils.toJsonBytes(nodeDataDTO);
    }

    public static NodeDataDTO from(byte[] bytes) {
        return JsonUtils.fromJson(bytes, NodeDataDTO.class);
    }
}
